package com.palm.platform.domain;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.sql.Types;
import java.util.List;
import java.util.Set;

import lombok.Data;
import org.noear.solon.annotation.Note;
import org.noear.solon.validation.annotation.*;
import org.sagacity.sqltoy.config.annotation.Entity;
import org.sagacity.sqltoy.config.annotation.Id;
import org.sagacity.sqltoy.config.annotation.Column;

@Data
@Note("t_user")
@Entity(tableName="t_user")
public class User implements Serializable{

    @Note("ID")
    @Id(strategy = "identity")
    @NotNull
    @Column(name="id",length=20L,type=Types.INTEGER,nullable=false)
    private Long id;

    @Note("用户名")
    @NotNull
    @Length(max=40)
    @Column(name="username",length=40L,type=Types.VARCHAR,nullable=false)
    private String username;

    @Note("密码")
    @NotNull
    @Length(max=128)
    @Column(name="password",length=128L,type=Types.VARCHAR,nullable=false)
    private String password;

    @Note("姓名")
    @Length(max=20)
    @Column(name="name",length=20L,type=Types.VARCHAR)
    private String name;

    @Note("部门编码")
    @Length(max=20)
    @Column(name="branch_sn",length=20L,type=Types.VARCHAR)
    private String branchSn;

    @Note("头像")
    @Length(max=255)
    @Column(name="avatar",length=255L,type=Types.VARCHAR)
    private String avatar;

    @Note("手机号")
    @Length(max=40)
    @Column(name="phone",length=40L,type=Types.VARCHAR)
    private String phone;

    @Note("启用")
    @Column(name="enable",length=1L,type=Types.BIT)
    private Boolean enable;

    @Note("性别")
    @Length(max=1)
    @Column(name="gender",length=1L,type=Types.VARCHAR)
    private String gender;

//    @Note("角色 一对多")
//    @Length(max=255)
//    @Column(name="roles",length=255L,type=Types.VARCHAR)
//    private String roles;

    @Note("创建人")
    @Length(max=40)
    @Column(name="create_user",length=40L,type=Types.VARCHAR)
    private String createUserId;

    @Note("最后登录IP")
    @Length(max=255)
    @Column(name="login_ip",length=255L,type=Types.VARCHAR)
    private String loginIp;

    @Note("最后登录时间")
    @Column(name="login_time",length=26L,type=Types.TIMESTAMP)
    private Date loginTime;

    @Note("记录创建时间")
    @Column(name="create_time",length=26L,type=Types.TIMESTAMP)
    private Date createTime;

    @Note("更新时间")
    @Column(name="update_time",length=26L,type=Types.TIMESTAMP)
    private Date updateTime;

    private Set<String> roles;

    //用于查询的role
    private String role;
}
